﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace myDBtest
{
    public partial class LogonWindow : ChildWindow
    {
        public LogonWindow()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            ServiceReference1.myWCFserviceClient client = new ServiceReference1.myWCFserviceClient();
            client.loginCompleted += client_loginCompleted;
            client.loginAsync(loginTextBox.Text.Trim(), passwordTextBox.Password.Trim());
        }

        void client_loginCompleted(object sender, ServiceReference1.loginCompletedEventArgs e)
        {
            var result = e.Result;
            if (result)
            {
                MessageBox.Show("Anmeldung erfolgreich!");
                Close();
            }
            else
                MessageBox.Show("Die eingegebenen Benutzerdaten sind fehlerhaft. Versuchen Sie es erneut");
            int i = 10;
        }

    }
}

